package org.example.demo3.service.impl;

import org.example.demo3.entity.Survey;
import org.example.demo3.mapper.SurveyMapper;
import org.example.demo3.service.SurveyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SurveyServiceImpl implements SurveyService {

    @Autowired
    private SurveyMapper surveyMapper;

    @Override
    public List<Survey> getAllSurveys() {
        return surveyMapper.getAllSurveys();
    }

    @Override
    public Survey getSurveyById(Integer id) {
        return surveyMapper.getSurveyById(id);
    }

    @Override
    public void createSurvey(Survey survey) {
        surveyMapper.insertSurvey(survey);
    }

    @Override
    public void updateSurvey(Survey survey) {
        surveyMapper.updateSurvey(survey);
    }

    @Override
    public void deleteSurvey(Integer id) {
        surveyMapper.deleteSurvey(id);
    }
}
